Chris Pollett > Old Classes >
CS116a

( Print View )

Student Corner:
  [Grades Sec1]

  [Submit Sec1]

  [Email List Sec1]

  [
Lecture Notes]

Course Info:
  [Texts & Links]
  [Topics]
  [Grading]
  [HW Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]

Practice Exams:
  [Mid1]  [Mid2]  [Final]

                           












HW#3 --- last modified March 02 2019 21:10:19..

Solution set.

Due date: Oct 27

Files to be submitted:
  Hw3.pdf
  aliastrans.cpp

Purpose: To become familiar, with the anti-aliasing and 2D-transformation techniques learned in class.

Specification:

Do the following problems out of the book: 5.2, 5.5. Submit these in the file Hw3.pdf. My guidelines page for Master's students has some info on creating PDF files if you don't have Acrobat.

Next in the file aliastrans.cpp, rewrite your two functions:

void polyLineBres(int x[], int y[], int len);

and

void circleArcMidpoint(GLint xc, GLint yc, GLint r, GLfloat startTheta, GLfloat endTheta);

from HW1 so that they now support drawing lines and curves in an anti-alias'd way using supersampling. To be concrete divide each pixel into at least a 3x3 array of subpixels, assume the line color is black and the background is white and use the alpha value of your line for blending. Represent a house and sun with lines and arcs. When you launch your program, have your program read in a file parameters.txt. This file might look like:

400 300
10 30
78
2.3

Your program then draws your house and sun according to these parameters. Here the first line says the dimensions of the window. The second line says a horizontal and vertical displacement of you picture from the origin. The next line says an angle in degrees to rotate your image about the origin by after the translation. Finally, the last line says a scaling to do to your picture after the other two operations. To implement the above write your own matrix code that makes use of homogeneous coordinates and transformations.

Point Breakdown

Departmental coding guidelines for C++ followed 1pt
5.2 2pts
5.52pts
Anti-aliasing with supersampling works 2pts
Transformations done with your code for matrices works 2pts
File is read in correctly1pt
Total10pts